<?xml version="1.0" encoding="iso-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Parallel Python - Parallel Python documentation</title>
</head>
<body>
&nbsp;&nbsp;Please visit <a href='http://www.parallelpython.com'>http://www.parallelpython.com</a> for extended up-to-date
documentation, examples and support forums	

		<div class="mainbody">
						<table class="contentpaneopen">
			<tr>
								<td class="contentheading" width="100%">
			<h1>		Parallel Python documentation	</h1>								</td>
						</tr>
			</table>

		<table class="contentpaneopen">
				<tr>
			<td valign="top" colspan="2">
				<p>&nbsp;<a href="#API">Module API</a> <br />&nbsp;<a href="#QUICKSMP">Quick start guide, SMP</a><br />&nbsp;<a href="#QUICKCLUSTERS">Quick start guide, clusters<br />&nbsp;</a><a href="#QUICKCLUSTERSAUTO">Quick start guide, clusters with auto-discovery</a><br /> &nbsp;<a href="#ADVANCEDCLUSTERS">Advanced guide, clusters</a><br /> &nbsp;<a href="#COMMANDLINE">Command line arguments, ppserver.py</a><br />&nbsp;<a href="#SECURITY">Security and secret key</a>  </p><hr /> <p>&nbsp;</p><h1 id="API">&nbsp; pp 1.5.7 module API</h1>   <p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom">&nbsp;<br /> <font face="helvetica, arial" color="#000000"><a name="Server" title="Server"></a>class <strong>Server</strong></font></td></tr>      <tr bgcolor="#ffc8d8"><td rowspan="2">&nbsp;&nbsp;&nbsp;</td> <td colspan="2">Parallel&nbsp;Python&nbsp;SMP&nbsp;execution&nbsp;server&nbsp;class<br />&nbsp;</td></tr> <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br />  <dl><dt><a name="Server-__init__" title="Server-__init__"></a><strong>__init__</strong>(self, ncpus<font color="#909090">=&#39;autodetect&#39;</font>, ppservers<font color="#909090">=()</font>, secret<font color="#909090">=None</font>, loglevel<font color="#909090">=30</font>, logstream<font color="#909090">=&lt;open file &#39;&lt;stderr&gt;&#39;, mode &#39;w&#39;&gt;</font>, restart<font color="#909090">=False</font>, proto<font color="#909090">=0</font>)</dt><dd>Creates&nbsp;<a href="#Server">Server</a>&nbsp;instance<br />  &nbsp;<br /> ncpus&nbsp;-&nbsp;the&nbsp;number&nbsp;of&nbsp;worker&nbsp;processes&nbsp;to&nbsp;start&nbsp;on&nbsp;the&nbsp;local&nbsp;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;computer,&nbsp;if&nbsp;parameter&nbsp;is&nbsp;omitted&nbsp;it&nbsp;will&nbsp;be&nbsp;set&nbsp;to&nbsp;<br />  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system<br /> ppservers&nbsp;-&nbsp;list&nbsp;of&nbsp;active&nbsp;parallel&nbsp;python&nbsp;execution&nbsp;servers&nbsp;<br />  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;connect&nbsp;with<br /> secret&nbsp;-&nbsp;passphrase&nbsp;for&nbsp;network&nbsp;connections,&nbsp;if&nbsp;omitted&nbsp;a&nbsp;default<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;passphrase&nbsp;will&nbsp;be&nbsp;used.&nbsp;It&#39;s&nbsp;highly&nbsp;recommended&nbsp;to&nbsp;use&nbsp;a&nbsp;<br />  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;custom&nbsp;passphrase&nbsp;for&nbsp;all&nbsp;network&nbsp;connections.<br /> loglevel&nbsp;-&nbsp;logging&nbsp;level<br />logstream&nbsp;-&nbsp;log&nbsp;stream&nbsp;destination<br/> restart&nbsp;-&nbsp;whether&nbsp;to&nbsp;restart&nbsp;worker&nbsp;process&nbsp;after&nbsp;each&nbsp;task&nbsp;completion&nbsp;<br/> proto&nbsp;-&nbsp;protocol&nbsp;number&nbsp;for&nbsp;pickle&nbsp;module&nbsp;<br /><br /> With&nbsp;ncpus&nbsp;=&nbsp;1&nbsp;all&nbsp;tasks&nbsp;are&nbsp;executed&nbsp;consequently<br /> For&nbsp;the&nbsp;best&nbsp;performance&nbsp;either&nbsp;use&nbsp;the&nbsp;default&nbsp;&quot;autodetect&quot;&nbsp;value<br />  or&nbsp;set&nbsp;ncpus&nbsp;to&nbsp;the&nbsp;total&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system</dd></dl><dl><dt><a name="Server-destroy" title="Server-destroy"></a><strong>destroy</strong>(self)</dt><dd>Kills&nbsp;local&nbsp;ppworkers&nbsp;and&nbsp;closes&nbsp;open&nbsp;files</dd></dl>  <dl><dt><a name="Server-get_active_nodes" title="Server-get_active_nodes"></a><strong>get_active_nodes</strong>(self)</dt><dd>Returns&nbsp;active&nbsp;nodes&nbsp;as&nbsp;a&nbsp;dictionary&nbsp;<br />  [keys&nbsp;-&nbsp;nodes,&nbsp;values&nbsp;-&nbsp;ncpus]</dd></dl>  <dl><dt><a name="Server-get_ncpus" title="Server-get_ncpus"></a><strong>get_ncpus</strong>(self)</dt><dd>Returns&nbsp;the&nbsp;number&nbsp;of&nbsp;local&nbsp;worker&nbsp;processes&nbsp;(ppworkers)</dd></dl>  <dl><dt><a name="Server-get_stats" title="Server-get_stats"></a><strong>get_stats</strong>(self)</dt><dd>Returns&nbsp;job&nbsp;execution&nbsp;statistics&nbsp;as&nbsp;a&nbsp;dictionary</dd></dl><dl><dt><a name="Server-print_stats" title="Server-print_stats"></a><strong>print_stats</strong>(self)</dt><dd>Prints&nbsp;job&nbsp;execution&nbsp;statistics.&nbsp;Useful&nbsp;for&nbsp;benchmarking&nbsp;on&nbsp;<br />  clusters</dd></dl>  <dl><dt><a name="Server-set_ncpus" title="Server-set_ncpus"></a><strong>set_ncpus</strong>(self, ncpus<font color="#909090">=&#39;autodetect&#39;</font>)</dt><dd>Sets&nbsp;the&nbsp;number&nbsp;of&nbsp;local&nbsp;worker&nbsp;processes&nbsp;(ppworkers)<br /> &nbsp;<br />  ncpus&nbsp;-&nbsp;the&nbsp;number&nbsp;of&nbsp;worker&nbsp;processes,&nbsp;if&nbsp;parammeter&nbsp;is&nbsp;omitted<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it&nbsp;will&nbsp;be&nbsp;set&nbsp;to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system</dd></dl>  <dl><dt><a name="Server-submit" title="Server-submit"></a><strong>submit</strong>(self, func, args<font color="#909090">=()</font>, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">=&#39;default&#39;</font>, globals<font color="#909090">=None</font>)</dt><dd>Submits&nbsp;function&nbsp;to&nbsp;the&nbsp;execution&nbsp;queue<br />  &nbsp;<br /> func&nbsp;-&nbsp;function&nbsp;to&nbsp;be&nbsp;executed<br /> args&nbsp;-&nbsp;tuple&nbsp;with&nbsp;arguments&nbsp;of&nbsp;the&nbsp;&#39;func&#39;<br />  depfuncs&nbsp;-&nbsp;tuple&nbsp;with&nbsp;functions&nbsp;which&nbsp;might&nbsp;be&nbsp;called&nbsp;from&nbsp;&#39;func&#39;<br /> modules&nbsp;-&nbsp;tuple&nbsp;with&nbsp;module&nbsp;names&nbsp;to&nbsp;import<br />  callback&nbsp;-&nbsp;callback&nbsp;function&nbsp;which&nbsp;will&nbsp;be&nbsp;called&nbsp;with&nbsp;argument&nbsp;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;equal&nbsp;to&nbsp;callbackargs+(result,)&nbsp;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;soon&nbsp;as&nbsp;calculation&nbsp;is&nbsp;done<br />  callbackargs&nbsp;-&nbsp;additional&nbsp;arguments&nbsp;for&nbsp;callback&nbsp;function<br /> group&nbsp;-&nbsp;job&nbsp;group,&nbsp;is&nbsp;used&nbsp;when&nbsp;<a href="#Server-wait">wait</a>(group)&nbsp;is&nbsp;called&nbsp;to&nbsp;wait&nbsp;for<br />  jobs&nbsp;in&nbsp;a&nbsp;given&nbsp;group&nbsp;to&nbsp;finish<br /> globals&nbsp;-&nbsp;dictionary&nbsp;from&nbsp;which&nbsp;all&nbsp;modules,&nbsp;functions&nbsp;and&nbsp;classes<br />  will&nbsp;be&nbsp;imported,&nbsp;for&nbsp;instance:&nbsp;globals=globals()</dd></dl>  <dl><dt><a name="Server-wait" title="Server-wait"></a><strong>wait</strong>(self, group<font color="#909090">=None</font>)</dt><dd>Waits&nbsp;for&nbsp;all&nbsp;jobs&nbsp;in&nbsp;a&nbsp;given&nbsp;group&nbsp;to&nbsp;finish.<br />  If&nbsp;group&nbsp;is&nbsp;omitted&nbsp;waits&nbsp;for&nbsp;all&nbsp;jobs&nbsp;to&nbsp;finish</dd></dl>  <dl><dt><strong>default_port</strong> = 60000</dt></dl>  <dl><dt><strong>default_secret</strong> = &#39;epo20pdosl;dksldkmm&#39;</dt></dl>  </td></tr></tbody></table> </p>


<p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section"> <tbody><tr bgcolor="#ffc8d8"> <td colspan="3" valign="bottom">&nbsp;<br /> <font face="helvetica, arial" color="#000000"><a name="Template" title="Template"></a>class <strong>Template</strong></font></td></tr>      <tr bgcolor="#ffc8d8"><td rowspan="2">&nbsp;&nbsp;&nbsp;</td> <td colspan="2"><a href="#Template">Template</a>&nbsp;class<br />&nbsp;</td></tr>  <tr><td>&nbsp;</td> <td width="100%">Methods defined here:<br /> <dl><dt><a name="Template-__init__" title="Template-__init__"></a><strong>__init__</strong>(self, job_server, func, depfuncs<font color="#909090">=()</font>, modules<font color="#909090">=()</font>, callback<font color="#909090">=None</font>, callbackargs<font color="#909090">=()</font>, group<font color="#909090">=&#39;default&#39;</font>, globals<font color="#909090">=None</font>)</dt><dd>Creates&nbsp;<a href="#Template">Template</a>&nbsp;instance<br />  &nbsp;<br /> jobs_server&nbsp;-&nbsp;pp&nbsp;server&nbsp;for&nbsp;submitting&nbsp;jobs<br /> func&nbsp;-&nbsp;function&nbsp;to&nbsp;be&nbsp;executed<br /> depfuncs&nbsp;-&nbsp;tuple&nbsp;with&nbsp;functions&nbsp;which&nbsp;might&nbsp;be&nbsp;called&nbsp;from&nbsp;&#39;func&#39;<br />  modules&nbsp;-&nbsp;tuple&nbsp;with&nbsp;module&nbsp;names&nbsp;to&nbsp;import<br /> callback&nbsp;-&nbsp;callback&nbsp;function&nbsp;which&nbsp;will&nbsp;be&nbsp;called&nbsp;with&nbsp;argument&nbsp;<br />  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list&nbsp;equal&nbsp;to&nbsp;callbackargs+(result,)&nbsp;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as&nbsp;soon&nbsp;as&nbsp;calculation&nbsp;is&nbsp;done<br /> callbackargs&nbsp;-&nbsp;additional&nbsp;arguments&nbsp;for&nbsp;callback&nbsp;function<br />  group&nbsp;-&nbsp;job&nbsp;group,&nbsp;is&nbsp;used&nbsp;when&nbsp;wait(group)&nbsp;is&nbsp;called&nbsp;to&nbsp;wait&nbsp;for<br /> jobs&nbsp;in&nbsp;a&nbsp;given&nbsp;group&nbsp;to&nbsp;finish<br />  globals&nbsp;-&nbsp;dictionary&nbsp;from&nbsp;which&nbsp;all&nbsp;modules,&nbsp;functions&nbsp;and&nbsp;classes<br /> will&nbsp;be&nbsp;imported,&nbsp;for&nbsp;instance:&nbsp;globals=globals()</dd></dl>  <dl><dt><a name="Template-submit" title="Template-submit"></a><strong>submit</strong>(self, *args)</dt><dd>Submits&nbsp;function&nbsp;with&nbsp;*arg&nbsp;arguments&nbsp;to&nbsp;the&nbsp;execution&nbsp;queue</dd></dl>   </td></tr></tbody></table></p>


<p> <table border="0" cellspacing="0" cellpadding="2" width="100%" summary="section">  <tbody><tr bgcolor="#55aa55"> <td colspan="3" valign="bottom">&nbsp;<br /> <font face="helvetica, arial" color="#ffffff"><strong>Data</strong></font></td></tr>      <tr><td bgcolor="#55aa55">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>&nbsp;</td> <td width="100%"><strong>copyright</strong> = &#39;Copyright (c) 2005-2009 Vitalii Vanovschi. All rights reserved&#39;<br /> <strong>version</strong> = &#39;1.5.7&#39;</td></tr></tbody></table>      </p><hr /><h1 id="QUICKSMP">&nbsp; Quick start guide, SMP<br /></h1> <p>1) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>2) Start pp execution server with the number of workers set to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system </p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server()&nbsp;</strong></p><p>3) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p>&nbsp;&nbsp; ...etc...<br /></p><p>4) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p> <hr /><h1 id="QUICKCLUSTERS">&nbsp; Quick start guide, clusters&nbsp; </h1><p><em><strong>On the nodes</strong></em> <br /></p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong>&nbsp;&nbsp;&nbsp; node-1&gt; ./ppserver.py </strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-2&gt; ./ppserver.py</strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-3&gt; ./ppserver.py</strong></p><p><em><strong>On the client</strong></em> <br /></p><p>2) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>3)&nbsp; Create a list of all the nodes in your cluster (computers where you&#39;ve run ppserver.py) </p><p><strong>&nbsp;&nbsp;&nbsp; ppservers=(&quot;node-1&quot;, &quot;node-2&quot;, &quot;node-3&quot;)</strong><br /></p><p>4) Start pp execution server with the number of workers set to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system and list of ppservers to connect with :</p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>)&nbsp;</strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p>&nbsp;&nbsp; ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a></p> <hr /><h1 id="QUICKCLUSTERSAUTO">&nbsp; Quick start guide, clusters with autodiscovery<br /> </h1><p><em><strong>On the nodes</strong></em>&nbsp;</p><p>1) Start parallel python execution server on all your remote computational nodes:</p><p><strong>&nbsp;&nbsp;&nbsp; node-1&gt; ./ppserver.py -a<br /> </strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-2&gt; ./ppserver.py -a</strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-3&gt; ./ppserver.py -a<br /></strong></p><p><em><strong>On the client</strong></em></p><p>2) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>3)&nbsp; Set ppservers list to auto-discovery: </p><p><strong>&nbsp;&nbsp;&nbsp; ppservers=(&quot;*&quot;,)</strong><br /></p><p>4) Start pp execution server with the number of workers set to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system and list of ppservers to connect with :</p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>)&nbsp;</strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p>&nbsp;&nbsp; ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a>&nbsp; </p><hr /><h1 id="ADVANCEDCLUSTERS">&nbsp;&nbsp;&nbsp; Advanced guide, clusters&nbsp; </h1> <p><em><strong>On the nodes</strong></em> &nbsp;</p><p>1) Start parallel python execution server on all your remote computational nodes (listen to a given port 35000,<br /> and local network interface only, accept only connections which know correct secret):</p><p><strong>&nbsp;&nbsp;&nbsp; node-1&gt; ./ppserver.py -p 35000 -i 192.168.0.101 -s &quot;mysecret&quot;<br /></strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-2&gt; ./ppserver.py -p 35000 -i 192.168.0.102</strong><strong> -s &quot;mysecret&quot;</strong></p><p><strong>&nbsp;&nbsp;&nbsp; node-3&gt; ./ppserver.py -p 35000 -i 192.168.0.103</strong><strong> -s &quot;mysecret&quot;</strong></p><p><em><strong>On the client</strong></em> <br /></p> <p>2) Import pp module:</p><p><strong>&nbsp;&nbsp;&nbsp; import pp</strong></p><p>3)&nbsp; Create a list of all the nodes in your cluster (computers where you&#39;ve run ppserver.py) </p><p><strong>&nbsp;&nbsp;&nbsp; ppservers=(&quot;node-1:35000&quot;, &quot;node-2:</strong><strong>35000</strong><strong>&quot;, &quot;node-3:</strong><strong>35000</strong><strong>&quot;)</strong><br /></p><p>4) Start pp execution server with the number of workers set to&nbsp;the&nbsp;number&nbsp;of&nbsp;processors&nbsp;in&nbsp;the&nbsp;system, <br />list of ppservers to connect with and secret key to authorize the connection:</p><p><strong>&nbsp;&nbsp;&nbsp; job_server = pp.Server(</strong><strong>ppservers=</strong><strong>ppservers</strong><strong>, secret=&quot;</strong><strong>mysecret</strong><strong>&quot;)&nbsp;</strong></p><p>5) Submit all the tasks for parallel execution:</p><p><strong>&nbsp;&nbsp;&nbsp; f1 = job_server.submit(func1, args1, depfuncs1, modules1)</strong></p><p><strong>&nbsp;&nbsp;&nbsp; f2 = job_server.submit(func1, args2, depfuncs1, modules1) </strong></p><p><strong>&nbsp;&nbsp;&nbsp; f3 = job_server.submit(func2, args3, depfuncs2, modules2) </strong><br /> </p><p>&nbsp;&nbsp; ...etc...<br /></p><p>6) Retrieve the results as needed:</p><p><strong>&nbsp;&nbsp;&nbsp; r1 = f1()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r2 = f2()</strong></p><p><strong>&nbsp;&nbsp;&nbsp; r3 = f3()&nbsp;</strong> </p><p>&nbsp;&nbsp;&nbsp; ...etc...</p><p>&nbsp;7) Print the execution statistics:<br /></p><p><strong>&nbsp;&nbsp;&nbsp; job_server.print_stats()</strong></p><p>To find out how to achieve efficient parallelization with pp please take a look at <a href="http://www.parallelpython.com/content/view/17/31/" title="Parallel Python Implementation Examples">examples</a> </p><hr /><h1 id="COMMANDLINE">&nbsp; Command line options, ppserver.py </h1> 
<pre>
Usage: ppserver.py [-hdar] [-n proto] [-c config_path] [-i interface] [-b broadcast] [-p port] [-w nworkers] [-s secret] [-t seconds]

Options:
-h                 : this help message
-d                 : debug
-a                 : enable auto-discovery service
-r                 : restart worker process after each task completion
-n proto           : protocol number for pickle module
-c path            : path to config file
-i interface       : interface to listen
-b broadcast       : broadcast address for auto-discovery service
-p port            : port to listen
-w nworkers        : number of workers to start
-s secret          : secret for authentication
-t seconds         : timeout to exit if no connections with clients exist
</pre>
<hr /><h1 id="COMMANDLINE">&nbsp; Security and secret key<a name="SECURITY" title="SECURITY"></a></h1><p>&nbsp;Due to the security concerns it is highly recommended to run ppserver.py with an non-trivial secret key (-s command line argument) which should be paired with the matching <em>secret</em> keyword of PP Server class constructor. Since PP 1.5.3 it is possible to set secret key by assigning <strong>pp_secret</strong> variable in the configuration file <strong>.pythonrc.py</strong> which should be located in the user home directory (please make this file readable and writable only by user). The secret key set in .pythonrc.py could be overridden by command line argument (for ppserver.py) and <em>secret</em> keyword (for PP Server class constructor). </p>

			</td>
		</tr>
				</table>
		
		<span class="article_seperator">&nbsp;</span>
		
				</div>
	</div>
						<div class="footer">
						
<div align="center">
<font color="gray">Parallel Python Solutions | Parallel Python Forums | Parallel Python Community</font>
</div>
<br/>
<div align="center">
<font color="gray">Parallel Python	&copy; 2005 - 2009 Vitalii Vanovschi. All rights reserved</font>
</div>
		</div>
				</div>
</div>
</body>
</html><!-- 1202744006 -->
